<!doctype html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>年龄限制</title>
</head>
<body>
	<select id="first" onblur="getnum()" ></select>
	<select id="second"></select>

	<script>
		var list1 = [];
		var list2 = []; //定义存放年龄的数组
		var num = ''; //获取第一个选项框的值，作为第二个选项框的条件
		var first = document.getElementById('first');
		var second = document.getElementById('second');

		for (var i = 10; i <60; i++){
			list1[i] = i;					//制作数组
		}

		for(var i=10; i<60;i++){

			first.add(new Option(list1[i],i));		//遍历出option标签
			
		}
		console.log(first);

		function getnum(){
			second.options.length = 0;				//释放原来的第二个选项框的数据
			num = first.value;
			console.log(num);
			// console.log(typeof(num));

			for (var i = num; i <60; i++){
				list2[i] = i;
			}

			for(var i=num; i<60;i++){

				second.add(new Option(list2[i],i));			//遍历
			
			}

		}

	</script>
</body>
</html>